package com.bdqn.ch03.SZ.sz1;

/**
 * Controller  控制器类
 *
 * @aurhor Administrator  whs
 * @since 2024/7/4
 */
public class Controller {

    //根据传入的运算符动态调用不同的实现方法
    public Calculate ControllerCalculate(String str){
        switch (str) {
            case "+" :
                return new AddCalculatesImpl();
            case "-" :
                return new MinusCalculatesImpl();
            case "*" :
                return new RideCalculatesImpl();
            case "/" :
                return new DivideCalculateImpl();
            case "%" :
                return new RemainderCalculateImpl();
        }
        return null;
    }
}
